package org.csc.chaincode;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hyperledger.fabric.shim.ChaincodeStub;

import java.util.Arrays;

public class ChainCodeLog {

    private static final Log log = LogFactory.getLog(ChainCodeLog.class);

    /**
     * 日志打印
     * @param stub 请求实体
     */
    public static void log(ChaincodeStub stub) {
        log.info(String.format("请求的全部信息 =》%s ", Arrays.asList(stub.getStringArgs())));
        log.info(String.format("调用的函数 =》%s ,请求参数 =》%s ", stub.getFunction(), Arrays.asList(stub.getParameters())));
    }

    /**
     * 日志打印
     * @param message 日志信息
     */
    public static void log(String message) {
        log.info(message);
    }
}
